package tw.com.hitevision.whiteboard.android.retrofit.service;

import io.reactivex.Observable;
import okhttp3.ResponseBody;
import retrofit2.Response;
import retrofit2.adapter.rxjava2.Result;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Query;
import tw.com.hitevision.whiteboard.android.retrofit.response.youtube.ChannelsList;
import tw.com.hitevision.whiteboard.android.retrofit.response.youtube.SearchList;
import tw.com.hitevision.whiteboard.android.retrofit.response.youtube.VideoList;

public interface YoutubeAPIService {

    String API_KEY = "AIzaSyDtPSKY3rf3KU50Fp776wXMwN5qMckyTR8";   //AIzaSyAIQK9hyhmKZJP_s2xxajw9bvC6uziBvgY
    String API_KEY_MSTAR = "AIzaSyD3efDK_meahrsCHhod2ufcC9QDDWhpskY"; //mstar
    String API_KEY_AMLOGIC = "AIzaSyAXYo8LUfeOnrB24KNNdkvEpFEYDZZxaz4"; //amlogic
    String Q_KEY = "key";
    String H_AUTHORIZATION = "Authorization";
    String Q_PART = "part";
    String Q_CHART = "chart";
    String Q_MAX_RESULTS = "maxResults";
    String Q_REGION_CODE = "regionCode";
    String Q_MINE = "mine";

    @GET("youtube/v3/activities")
    Observable<Response<ResponseBody>>
    getYoutubeActivityList(@Header(H_AUTHORIZATION) String token,
                           @Query(Q_PART) String snippet,
                           @Query(Q_PART) String contentDetails,
                           @Query(Q_MINE) boolean mine,
                           @Query(Q_MAX_RESULTS) int maxResults,
                           @Query(Q_REGION_CODE) String regionCode);


    String Q_PAGE_TOKEN = "pageToken";
    String Q_FIELDS = "fields";
    String Q_ID = "id";

    @GET("youtube/v3/videos")
    Observable<Result<VideoList>>
    getYoutubeVideoList(@Query(Q_KEY) String key,
                        @Query(Q_PART) String snippet,
                        @Query(Q_PART) String statistics,
                        @Query(Q_CHART) String chart,
                        @Query(Q_ID) String id,
                        @Query(Q_MAX_RESULTS) int maxResults,
                        @Query(Q_REGION_CODE) String regionCode,
                        @Query(Q_PAGE_TOKEN) String pageToken,
                        @Query(Q_FIELDS) String fields);


    String Q_ORDER = "order";
    String Q_TYPE = "type";
    String Q_QUERY = "q";

    @GET("youtube/v3/search")
    Observable<Result<SearchList>>
    getYoutubeSearchList(@Query(Q_KEY) String key,
                         @Query(Q_PART) String snippet,
                         @Query(Q_ORDER) String order,
                         @Query(Q_TYPE) String type,
                         @Query(Q_QUERY) String q,
                         @Query(Q_MAX_RESULTS) int maxResults,
                         @Query(Q_REGION_CODE) String regionCode,
                         @Query(Q_PAGE_TOKEN) String pageToken);



    @GET("youtube/v3/channels")
    Observable<Result<ChannelsList>>
    getYoutubeChannelsList(@Query(Q_KEY) String key,
                           @Query(Q_PART) String snippet,
                           @Query(Q_ID) String id,
                           @Query(Q_MAX_RESULTS) int maxResults,
                           @Query(Q_PAGE_TOKEN) String pageToken);
}